#include <jni.h>
//#include "../../../../../Program Files/Java/jdk1.6.0_33/include/jni.h"
#include <stdio.h>
#include "HelloWorldNative.h"

JNIEXPORT jintArray JNICALL Java_helloworld_Clibrary_nativePrint
    (JNIEnv *env, jobject obj, jint liczba, jintArray liczby)
{
    //make int tab[]  from jintArray liczby
    jint *tab = (*env)->GetIntArrayElements(env, liczby, 0);
    jsize len = (*env)->GetArrayLength(env, liczby);
    //end
    
    printf("\nHello World from C\n");
    //printf(js);
    //printf("%i \n", liczba*10);
    int i = 0;
    while (i<len){
        printf("%i: %i \n",i, tab[i]);
        tab[i]=5;
        i++;
    }
    
    //make jintArrat ret  from int tab[] from 0 to len
    jintArray ret;
    ret = (*env)->NewIntArray(env, len);
    (*env)->SetIntArrayRegion(env, ret, 0, len, tab);
    //end and return
    return ret;
}

